﻿using System;
using System.Xml;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NetExp.MediaXenter.Utilities
{
    public class NavigationHelper
    {

        private PagePosition pagePosition;
        private ImpostazioniPosition impostazioniPosition = ImpostazioniPosition.Nessuno;
        public void SetPosition(PagePosition position)
        {
            pagePosition = position;
        }

        public PagePosition GetPosition()
        {
            return pagePosition;
        }


        public void SetImpostazioniPosition(ImpostazioniPosition position)
        {
            impostazioniPosition = position;

        }


        public ImpostazioniPosition GetImpostazioniPosition()
        {
            return impostazioniPosition;

        }
        public List<string> GetPulsantiImpostazioni(XmlDocument documento)
        {
            List<string> lista = new List<string>();

            IEnumerator numerator = documento.ChildNodes.GetEnumerator();

            while (numerator.MoveNext())
            {
                XmlLinkedNode nodo = (System.Xml.XmlLinkedNode)numerator.Current;
                if (nodo.Name == "Localization")
                {
                    foreach (XmlNode elemento in nodo.ChildNodes)
                    {
                        if (!(elemento is XmlComment))
                        {
                            if (elemento.Attributes["Text"].Value.StartsWith(Constants.LOCALIZATION_AREA_PAGINA_IMPOSTAZIONI))
                            {
                                lista.Add(elemento.Attributes["Text"].Value);
                            }
                        }
                    }
                }

            }


            return lista;
        }

    }
}
